<template>
  <el-form ref="form" :model="form" label-width="90px">
    <el-row>

      <el-col>
        <el-form-item label="项目名:">
          <el-input placeholder="请输入" v-model="form.projectname" :disabled="true" style="width: 500px"></el-input>
        </el-form-item>
      </el-col>

      <el-col>
        <el-form-item label="待发布版本:">
          <el-select v-model="form.branch" placeholder="请选择分支" @change="branchChange" style="width: 500px">
            <el-option v-for="(item, index) in branchList" :key="index" :label="item.name" :value="item.name"></el-option>
          </el-select>
        </el-form-item>
      </el-col>

      <el-col >
        <el-form-item>
          <el-button type="primary" @click="onSubmit">构建</el-button>
          <el-button @click="deployClose">取消</el-button>
        </el-form-item>
      </el-col>
      <!--el-col :span="12">
        <el-form-item label="版本信息:">
          <el-input placeholder="请输入" v-model="form.message"></el-input>
        </el-form-item>
      </el-col-->
    </el-row>

  </el-form>
</template>

<script>
// import { branchSeach } from "@/api/application.js";
export default {
  data() {
    return {
      form: {
        projectname: "",
        branch: "",
      },
      branchList: [],
      info: {}
    };
  },
  methods: {
    // async show(form) {
    //   this.info = { ...form };
    //   // 预加载
    //   try {
    //     const branchList = await getBranchList();
    //     this.branchList = branchList.data;
    //   } catch (error) {
    //     console.log(error);
    //   }
    //   // 加载内容
    //   this.getDate();
    // },
    // // 改变内容
    // branchChange() {
    //   this.getDate();
    // },
    // async getDate() {
    //   try {
    //     const res = await branchSeach({
    //       id: this.info.id,
    //       branch: this.form.branch
    //     });
    //     this.form = { ...res.data };
    //   } catch (error) {
    //     console.log(error);
    //   }
    // },
    onSubmit() {
      // buildApplication(this.form);
      this.deployClose();
      // this.$emit("Submit", this.form);
    },
    deployClose() {
      this.$emit("deployClose");
    }
  }
};
</script>

<style lang="scss" scoped></style>
